<template>
	<view class="wrap">
		<view class="top_nav_box">
			<navigation-custom :config="config" @customConduct="customConduct" />
		</view>
		<view class="con">
			<view class="status_bar"></view>
			<view class="blank-topbar"></view>
			<view class="regwrap">
				<view class="regtitle df j-sb" v-if="logintype=='account'">
					<view class=" color1 fz48 fwb">密码登录</view>
				</view>
				<form @submit="login">
					<view class="form">
						<view class="shouji" v-if="logintype=='account'">
							<view class="li df a-ic">
								<view class="lil color1 fz30">账号</view>
								<view class="lir flex1">
									<input type="number" maxlength="11" v-model="account" placeholder="请输入账号"
										placeholder-style="color: #909399;font-size:30rpx;" />
								</view>
							</view>
							<view class="li df a-ic">
								<view class="lil color1 fz30">密码</view>
								<view class="lir flex1 df j-sb a-ic">
									<input type="text" name="password" maxlength="16" :password="showpass"
										placeholder="请输入密码" placeholder-style="color: #909399;font-size:30rpx;" />
									<image @click="togglePassword" class="eye"
										:src="showpass?'https://wxapp.haopai.539360.com/haopai/buzhunkan.png':'https://wxapp.haopai.539360.com/haopai/dakai.png'"
										mode="aspectFit" style="width: 40rpx;height: 40rpx;"></image>
								</view>
							</view>
						</view>
						<view class="buton">
							<button :disabled="disabled" hover-class="hover" class="df fz30 j-sc a-ic colorf"
								form-type="submit">立即登录</button>
						</view>
					</view>
				</form>
			</view>
			<view class="xieyi_view">
				<img :src="is_void == false ? 'https://wxapp.haopai.539360.com/haopai/weixinzhonmg.png' : 'https://fangduoduo-1328761458.cos.ap-nanjing.myqcloud.com/mini_program/yxz_icon.png'"
					alt="" @click="gettonguo()" />
				<view class="xieyi_viewss">
					<view class="reporting_detil_jiesuan_navigationBar_xiue">
						我已阅读并同意
					</view>
					<view class="reporting_detil_jiesuan_navigationBar_xiues" @click="getuseragreement">
						《用户协议》
					</view>
					<view class="reporting_detil_jiesuan_navigationBar_xiue">
						和
					</view>
					<view class="reporting_detil_jiesuan_navigationBar_xiues" @click="getuseragreements">
						《隐私政策》
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import navigationCustom from "@/components/struggler-navigationCustom/navigation-custom";
	let myreg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/
	let app = getApp()
	export default {
		components: { 
			navigationCustom
		},
		data() {
			return {
				config: {
					title: "", //title
					bgcolor: "transparent", //背景颜色
					fontcolor: "#000", //文字颜色，默认白色
					type: 4, //type 1，3胶囊 2，4无胶囊模式
					transparent: false, //是否背景透明 默认白色
					linear: false, //是为开启下滑渐变
					share: false, //是否将主页按钮显示为分享按钮
					menuIcon: "../../static/icon/back2.png", //当type为3或者4的时候左边的icon文件位置，注意位置与当前页面不一样
				},
				disabled: false,
				codebutdisabled: false,
				showpass: true,
				logintype: 'account',
				mobile: '', //手机号
				account: '', //账号
				is_void: false
			};
		},
		onShow() {
			var tuiguangma = uni.getStorageSync('tuiguangma');
			if (tuiguangma == '' || tuiguangma == null || tuiguangma == undefined) {

			} else {
				this.tuiguangma = tuiguangma
			}
		},
		methods: {
			//密码展示与隐藏
			togglePassword() {
				if (this.showpass == false) {
					this.showpass = true
				} else if (this.showpass == true) {
					this.showpass = false
				} else {
					this.showpass = false
				}
			},
			//登录
			login(e) {
				let {account} = this
				let {password}=e.detail.value
				if(this.is_void == false){
					this.gettishi('请阅读并同意协议')
				}else if(!account.trim()){
					this.gettishi('请输入账号')
				}else if(!password){
					this.gettishi('请输入密码')
				}
			},
			//提示框
			gettishi(title){
				uni.showToast({
					title: title,
					icon: "none"
				})
			},
			//用户协议
			getuseragreement() {
				uni.navigateTo({
					url: '/pages/user_agreement'
				});
			},
			//隐私协议
			getuseragreements() {
				uni.navigateTo({
					url: '/pages/yinsi_agreement'
				});
			},
			toRegister() {
				uni.navigateTo({
					url: '/pages/logo/zhaohuimima'
				});
			},
			//点击同意协议
			gettonguo() {
				var a = this;
				if (a.is_void == false) {
					a.is_void = true;
				} else {
					a.is_void = false;
				}
			},
			// 返回上一页
			customConduct() {
				uni.navigateBack({
					delta: 1
				})
			},
		}
	}
</script>

<style lang="scss">
	.top_nav_box {
		top: 0;
		left: 0;
		z-index: 10;
	}

	.wrap {
		background: url('https://star.googom.cn/chuangge/me_bj.png') no-repeat center top;
		background-size: 100%;
	}

	.xieyi_view {
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		align-content: center;
		width: 750rpx;
		margin-top: 56rpx;
		position: fixed;
		bottom: 50rpx;

		image {
			width: 40rpx;
			height: 40rpx;
			margin-right: 8rpx;
		}
	}

	.xieyi_viewss {
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
	}

	.reporting_detil_jiesuan_navigationBar_xiues {
		font-size: 26rpx;
		font-weight: 400;
		letter-spacing: 1.04rpx;
		line-height: NaNpx;
		color: #05CF67;
	}

	.reporting_detil_jiesuan_navigationBar_xiue {
		font-size: 26rpx;
		font-weight: 400;
		letter-spacing: 1.04rpx;
		line-height: 40rpx;
		color: rgba(144, 147, 153, 1);
	}
</style>